home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 42 / Amiga Format AFCD42 (Issue 126, Aug 1999).iso / -serious- / programming / arexx / rexxbgui / rexxbgui.doc < prev    next >
Encoding:
Text File  |  1999-05-14  |  14.5 KB  |  425 lines

  1. rexxbgui.library version 1.1
  2. Date: April 23, 1999
  3. Copyright © Jilles Tjoelker 1999
  4.  
  5. New in V1.1:
  6. * New functions: bguiwinbusy(), bguiwinready(), bguipages(), bguimx(),
  7.   bguiactivategadget(), bguilist(), bguiaddcondit(), bguilistvaddentry(),
  8.   bguilistvcommand(), bguilistvreplacesel()
  9. * New argument for bgui[hv]group(), equal, to force equal width or height
  10.   of the objects in the group
  11. * New argument for bguiwindow(), pos, to open the window at a different
  12.   place than centred on the screen.
  13. * Some nonfunctional tags removed
  14. * New tags: BT_#?, PAGE_#?, MX_#?, TAG_IGNORE
  15. * Better documentation
  16. * Bug fixed: the library could be flushed from memory when a bguiopen() was
  17.   still outstanding.
  18. * A control-C break is now accepted immediately in bguiwinwaitevent() and
  19.   bguiwait() and passed to ARexx.
  20. * Bug fixed: BGUI 41.10 took the command name, which is always equal to "",
  21.   for the prefs filename. Fixed by temporarily setting the pr_Cli pointer to
  22.   zero.
  23.  
  24. Look in the example scripts for more information.
  25. General ARexx limitation: functions can only have up to 15 arguments.
  26.  
  27. ESCAPE SEQUENCES
  28. Escape sequences can be used in most texts, including labels, frame titles
  29. info object contents and listview entries. Frame titles may have shadow.
  30. Listview entries and labels within objects can be text on background or
  31. filltext on fill; when you change the colours it cannot be restored.
  32. ESC='1b'x or just use the Esc key to put it in a string constant.
  33.  
  34. ESC||ESC no operation; used to separate sequences ending in a digit
  35.          from normal digits.
  36. ESC'u'   underlined on
  37. ESC'b'   bold on
  38. ESC'i'   italics on
  39. ESC'n'   normal text
  40. ESC'd'n  set DrawInfo pen #n (2=text, 3=shine, 4=shadow, 5=selected-gadget
  41.          fill, 6=text on fill, 7=background, 8=important text)
  42. ESC'p'n  set colour #n
  43. ESC'D'n  set DrawInfo pen #n as background
  44. ESC'P'n  set colour #n as background
  45. ESC's'   shadow on (additionally use ESC'd3')
  46. ESC'-'ch turn something off (ch=u/b/i/s)
  47. ESC'c'   centre this and the following lines
  48. ESC'r'   right-justify this and the following lines
  49. ESC'l'   left-justify this and the following lines
  50. '0a'x    new line. This does not work for listview entries and frame titles.
  51.  
  52. FUNCTIONS
  53.  
  54. success=bguiopen([taskname],[noerrorifopenfail])
  55. This function opens bgui.library. Version 41 is required.
  56. taskname indicates the name of the prefs file, default "ARexx".
  57. Predefined are: ID.WIN(CLOSE|NOMORE|INACTIVE|ACTIVE).
  58. If this function has not yet been called, all functions starting with
  59. 'bgui' cause "Error return from function".
  60.  
  61. x=bguiwait()
  62. Wait for most events; Control-C is passed trough to ARexx
  63. (signal on break_c).
  64.  
  65. id=bguiwinevent(winobj,[destvar])
  66. This function does not wait for events.
  67.  
  68. id=bguiwaitwinevent(winobj,[destvar])
  69. This function is much more efficient than the bguiwinevent()/bguiwait()
  70. combination.
  71.  
  72. success=bguiwinopen(winobj)
  73. This function must be used to open a window. When a window object is created,
  74. it does not open automatically, unlike some other GUI engines' behaviour.
  75. This enables you to do things like bguiwintabcycleorder() in time.
  76.  
  77. x=bguiwinclose(winobj)
  78.  
  79. success=bguiwinbusy(winobj)
  80. Use this function to set a busy pointer and zero-size requester that blocks
  81. input on a window. It nests, i.e. the window will not be unblocked until
  82. one bguiwinready() has been done for each bguiwinbusy() executed.
  83.  
  84. success=bguiwinready(winobj)
  85.  
  86. obj=bguiwindow(title,mastergroup,[scalew],[scaleh],[refwin],[scrname],[pos])
  87. scale[wh]: 0% = minimum size, 100% = full screen
  88. Precede scalew and/or scaleh with a minus sign to lock the dimension.
  89. Locking both removes the size gadget.
  90. refwin: the new window object will open on the same screen as refwin
  91. pos 'S' centre on screen
  92.     'M' centre on mouse pointer
  93.     'T' top-left of the screen
  94.     'W' centre on window
  95.     'B' l t w h position in screen (pixel) coordinates
  96.     'R' l t w h centre window on this box
  97.  
  98. info=bguilayout(tag,value,[tag],[value],...)
  99. Concatenate the return value of this to an object. It does not work for
  100. VarSpace members.
  101.  
  102. info=bguivarspace(weight)
  103. A weight controlled spacing in a group; 1<weight<1023
  104. bguilayout() cannot be used on this.
  105.  
  106. obj=bgui[hv]group(objects,[spacing],[offset],[title],[equal])
  107. Double use of objects or forgotten '||' is caught -> error 12.
  108. spacing/offset -1 narrow
  109.                -2 normal
  110.                -3 wide
  111. offset 'F' frame (required for a title)
  112. equal 'W' all objects the same width
  113.       'H' all objects the same height
  114.       'S' all objects the same width and height
  115.  
  116. obj=bguipages(name,objects)
  117. This function only creates OBJ.name, not ID.name.
  118. Do not set PAGE_Active values which are out of range!
  119. The usage of pages increases the number of objects that can be in a window
  120. and therefore object creation time. The BGUI prefs program is an example of
  121. this!
  122.  
  123. obj=bguibutton(name,label)
  124. As other "real" gadget creation functions, this one sets both ID.name
  125. (compare with bguiwinevent() or bguiwinwaitevent() result) and OBJ.name (for
  126. bguiget() and similar functions).
  127.  
  128. Prefix the keyboard shortcut with '_' in label. This also applies to other
  129. gadgets.
  130.  
  131. obj=bguitoggle(name,label,[state])
  132.  
  133. obj=bguicheckbox(name,[label],[state])
  134.  
  135. obj=bguiinfo(name,[label],contents)
  136. Non-clickable information object.
  137.  
  138. obj=bguistring(name,[label],[contents],maxchars)
  139.  
  140. obj=bguiinteger(name,[label],[contents],[maxchars],[min],[max])
  141. It is not guaranteed, that min<=bguiget(int,STRINGA_LongVal)<=max.
  142.  
  143. obj=bguilistview(name,[label],[stem],[type],[ncolumns])
  144. type 'R' read-only
  145.      'S' select (default)
  146.      'D' drag'n'drop
  147. In multi-column listview entries, the columns are separated by a tab
  148. character. Attributes set with escape sequences do not continue from
  149. one column to the next.
  150. Optionally, you can append column weights to ncolumns, e.g. '3 10 45 45' to
  151. create one small column and two wider ones.
  152.  
  153. obj=bguimx(name,[label],stem,[type])
  154. type 'R' radio buttons (default)
  155.      'T' tabs
  156.      'U' upside down tabs
  157.  
  158. res=bguiget(obj,attr)
  159. Error descriptions here:
  160. "Invalid keyword" if you supplied an attribute that RexxBGUI does not know -
  161. see "tags" further on in this file for which attributes are available.
  162. "Error return from function" if the obj parameter was not OK or if the
  163. object did not understand the attribute, for example an attribute of another
  164. gadget class or one that is not gettable;
  165. "Wrong number of arguments" if rm->rm_Action & 0xF is not 2 or if
  166. rm_Args[1] or rm_Args[2] is equal to zero.
  167.  
  168. x=bguiset(obj,[refwin],tag,value,[tag],[value],...)
  169. refwin: window object in which the gadget is located; necessary if you want
  170. visual updating. Specifying another window causes strange results...
  171. If you need to set more than 6 tags, split it out over multiple calls and
  172. omit refwin in all possibly except the last. Put at least one attribute
  173. causing visual update in the last call, if you want any update.
  174.  
  175. gad=bguireq(text,gadgets,[title],[refwin],[scrname])
  176. RequestChoice/rtEZRequest() like requester. Use '|' to separate the gadgets.
  177. An asterisk adds return as a shortcut for the button it stands before and
  178. escape for the last one. Underscores can be used to prefix keyboard shortcuts.
  179. The window specified by refwin will automatically get a busypointer.
  180. Title defaults to refwin's title, or "BGUI Request" or its localized
  181. equivalent if wndobj is not given.
  182. Scrname does not work.
  183. gad: 1 for the first, 2 for the second, etc. and 0 for the last gadget.
  184.  
  185. success=bguiaddmap(srcobj,dstobj,sattr,dattr)
  186. This function connects two objects so srcobj will update dstobj's dattr
  187. when its sattr changes. This happens even without bguiwinevent().
  188.  
  189. Example usages:
  190. Listview with connected string gadget:
  191. call bguiaddmap(obj.listv,obj.str,LISTV_Entry,STRINGA_TextVal)
  192. Listview to select a page (#of listview entries must be #of pages!!!):
  193. call bguiaddmap(obj.listv,obj.pages,LISTV_EntryNumber,PAGE_Active)
  194.  
  195. The number of attributes that can cause notification (sattr) or be updated
  196. (dattr) is more limited than the number that can be used with bguiget() or
  197. bguiset(). If notification does not work, you'll have to fall back to the
  198. latter mechanism.
  199.  
  200. There is no "initial" notification.
  201.  
  202. Notification of LGO attributes may cause a crash. Using bguiset() is safer.
  203.  
  204. success=bguiaddcondit(srcobj,dstobj,iftag,ifval,thtag,thval,eltag,elval)
  205. This function connects two objects so srcobj will update dstobj depending
  206. on its ifattr. This is more or less equivalent to doing this when srcobj's
  207. iftag changes:
  208. IF bguiget(srcobj,iftag)=ifval THEN CALL bguiset(dstobj,thtag,thval),
  209.   ELSE CALL bguiset(dstobj,eltag,elval)
  210. This happens even without bguiwinevent(). See also bguiaddmap().
  211.  
  212. Integer tags only.
  213.  
  214. Always test boolean tags for 0 and never for 1.
  215.  
  216. Example usage:
  217. Yes/No setting that makes a choice impossible:
  218. call bguiaddcondit(obj.check,obj.mx,GA_Selected,0,MX_EnableButton,0,
  219. ,MX_DisableButton,0)
  220.  
  221. MX_DisableButton,n will never change MX_Active. You have to check separately
  222. if the selection is still possible.
  223.  
  224. If you init the checkbox to on, the first MX button will not be enabled
  225. initially. If you init the checkbox to off and set it to on after this call,
  226. it will be OK.
  227.  
  228. count=bguilistvgetentries(listvobj,stemname,[type])
  229. type 'A' all
  230.      'S' selected only
  231.  
  232. success=bguilistvaddentry(listvobj,[refwin],entry,[where],[flags])
  233. where 'H' head
  234.       'T' tail
  235.       'S' sorted
  236.       number add before entry n
  237. flags 'S' select
  238.       'M' multiselect
  239.       '+' make visible by scrolling list if necessary
  240.       '-' do not make visible
  241. 'S' or 'M' makes visible automatically unless disabled with '-'
  242.  
  243. rc=bguilistvcommand(listvobj,[refwin],command)
  244. command 'clear' delete all entries
  245.         'refresh' refresh listview and scroller
  246.         'sort'
  247.         'redraw' redraw all entries only
  248.         'remselected' single-select only; also selects new entry
  249.  
  250. success=bguilistvreplacesel(listvobj,[refwin],new)
  251. Use this function to replace the first selected entry of a listview by another.
  252. If no entry is selected, a new one is added and selected.
  253.  
  254. success=bguiwintabcycleorder(winobj,objects)
  255. RexxBGUI can only check the validity of the objects array to a limited
  256. extent: if a multiple of four spaces is intermixed wrong object pointers
  257. are used and a crash can be expected if tab is pressed in the first gadget.
  258.  
  259. success=bguiactivategadget(gadget,refwin)
  260. This call may fail, although that's usually not a severe problem...
  261. RexxBGUI can only check the validity of the objects to a limited extent.
  262.  
  263. x=bguiclose()
  264. This must be called before exiting the script.
  265.  
  266. success=bguireadentries(filename,stemname)
  267. When using READLN(), EOF cannot be distinguished from an empty line.
  268. Therefore this function is present. It reads lines from a file to a stem
  269. in a format suitable for the listview gadget.
  270.  
  271. stemname=bguilist(stemname,entry0,[entry1],...)
  272. This function allows you to place small lists (<=14 entries) for listviews
  273. directly in the gadget creation function, a bit like in E [e0,e1,...].
  274. It sets stemname.COUNT and stemname.x (0<=x<stemname.COUNT)
  275.  
  276. Example:
  277. ...
  278. bguilistview('switcher',,bguilist('pnames','Single-Select','Multi-Select'))||,
  279. ...
  280. drop pnames. /* not really necessary */
  281.  
  282. x=bguierror(code)
  283. This function causes an ARexx error, e.g. bguierror(12) causes "Error return
  284. from function".
  285.  
  286. TAGS: General information
  287. Types:
  288. INT=integer, may be boolean (0 means false, anything else means true)
  289. STRING=string
  290. OBJECT=4-byte pointer
  291.  
  292. Applicability: ISGNU
  293. I=Init (not applicable for RexxBGUI)
  294. S=Set (bguiset())
  295. G=Get (bguiget())
  296. N=Notify (bguiaddmap() sattr/bguiaddcondit() ifattr)
  297. U=Update (bguiaddmap() dattr/bguiaddcondit() thattr/elattr)
  298. -=not possible
  299. ?=not known to me, try it
  300.  
  301. WINDOW_#? TAGS
  302.  
  303. WINDOW_Window                 OBJECT --G--
  304.  
  305. INFO_#? TAGS
  306.  
  307. INFO_TextFormat               STRING IS--U
  308. INFO_MinLines                 INT
  309. INFO_FixTextWidth             INT
  310.  
  311. STRINGA_#? TAGS
  312.  
  313. STRINGA_TextVal               STRING ISGNU makes string gadget
  314. STRINGA_LongVal               INT    ISGNU makes integer gadget
  315. STRINGA_MaxChars              INT    I-?--
  316. STRINGA_BufferPos             INT    IS??? cursor position
  317. STRINGA_DispPos               INT    IS??? first char visible
  318.  
  319. LGO_#? TAGS
  320.  
  321. LGO_FixWidth                  INT
  322. LGO_FixHeight                 INT
  323. LGO_Weight                    INT
  324. LGO_FixMinWidth               INT
  325. LGO_FixMinHeight              INT
  326. LGO_Align                     INT
  327. LGO_NoAlign                   INT
  328. LGO_FixAspect                 INT
  329. LGO_Visible                   INT
  330.  
  331. LISTV_#? TAGS
  332.  
  333. LISTV_Top                     INT    ISG-U
  334. LISTV_ReadOnly                INT    ISG?? S/U will not change frame
  335. LISTV_MultiSelect             INT    IS?-U
  336. LISTV_Select                  INT    -S--U
  337. LISTV_MakeVisible             INT    -S--U
  338. LISTV_Entry                   STRING ---N-
  339. LISTV_EntryNumber             INT    ---N-
  340. LISTV_LastClicked             STRING --G--
  341. LISTV_LastClickedNum          INT    --G--
  342. LISTV_NewPosition             INT    ---N-
  343. LISTV_NumEntries              INT    --G--
  344. LISTV_MinEntriesShown         INT    ISG??
  345. LISTV_SelectMulti             INT    -S--U
  346. LISTV_SelectNotVisible        INT    -S--U
  347. LISTV_SelectMultiNotVisible   INT    -S--U
  348. LISTV_MultiSelectNoShift      INT    IS--U
  349. LISTV_Deselect                INT    -S--U
  350. LISTV_DropSpot                INT    --G--
  351. LISTV_ShowDropSpot            INT    IS---
  352. LISTV_Columns                 INT    I-G--
  353. LISTV_DragColumns             INT    ISG-U
  354. LISTV_Titles                  STRING I-G-U 41.8 Enforcer hits
  355. LISTV_Titles!                 OBJECT ISG-U static string problem
  356. LISTV_PreClear                INT    ISG--
  357. LISTV_LastColumn              INT    --G--
  358.  
  359. GA_#? TAGS
  360.  
  361. GA_Disabled                   INT    IS?-U
  362. GA_Selected                   INT    ISGNU toggles/checkboxes only
  363.  
  364. BT_#? TAGS
  365.  
  366. BT_LabelClick                 INT    IS---
  367. BT_DragObject                 INT    ISG--
  368. BT_DropObject                 INT    ISG--
  369. BT_Key                        STRING ISG-- set after creating window object only
  370. BT_RawKey                     INT    ISG-- set after creating window object only
  371. BT_Qualifier                  INT    ISG-- set after creating window object only
  372.  
  373. PAGE_#? TAGS
  374.  
  375. PAGE_Active                   INT    ISG?U
  376.  
  377. MX_#? TAGS
  378.  
  379. MX_Active                     INT    ISGNU
  380. MX_DisableButton              INT    IS--U
  381. MX_EnableButton               INT    IS--U
  382.  
  383. TAG_#? TAGS
  384.  
  385. TAG_IGNORE                    INT    IS--U does nothing!
  386.